gusucode.com > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM源码程序 > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM\stprtool\linear\finite\csvm.m
function [alpha,solution]=csvm(X) % CSVM separates point set from the origin by hyperplane. % [alpha,solution]=csvm(X) % % CSVM finds a normal vector of a hyperplane passing the % origin of coordinates and maximizing margin between given % point set (its convex hull) and the origin. % % In other words, the aim is to find such vector alpha lying % inside the convex hull of given set and having the smallest norm. % % Input: % X [D x M] matrix which contains M training points in D-dimensional % feature space. X=[x1,x2,..XM] where xi is i-th column % vectors. % % Output: % alpha [Dx1] normal vector of finding decision hyperplane. % solution [1x1] contains 1 if solution is found or 0 if solution % is not found. % % See also LINSVM, PERCEPTR, KOZINEC, EKOZINEC, EKOZINEC2. % % Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac % (c) Czech Technical University Prague, http://cmp.felk.cvut.cz % Written Vojtech Franc (diploma thesis) 29.10.1999 % Modifications % 11-june-2001, V. Franc, new comments. % 24. 6.00 V. Hlavac, comments polished. N=size(X,1); K=size(X,2); H=eye(N); f=zeros(N,1); b=-ones(K,1); A=-X'; % quadratic programming [alpha,lag,how]=qp(H,f,A,b,[],[],[],0,-1); if strcmp(lower(how),'ok'), solution=1; else solution=0; end